home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / rlbarcod / rlbar.cab / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-05  |  14.5 KB  |  347 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "RLBar BarCode OCX Extra Version DEMO"
  5.    ClientHeight    =   5952
  6.    ClientLeft      =   1128
  7.    ClientTop       =   756
  8.    ClientWidth     =   6696
  9.    Height          =   6336
  10.    Left            =   1080
  11.    LinkTopic       =   "Form1"
  12.    MousePointer    =   2  'Cross
  13.    ScaleHeight     =   5952
  14.    ScaleWidth      =   6696
  15.    Top             =   420
  16.    Width           =   6792
  17.    Begin VB.CommandButton Command2 
  18.       Caption         =   "Test Print All BarCode"
  19.       Height          =   405
  20.       Left            =   4740
  21.       MousePointer    =   1  'Arrow
  22.       TabIndex        =   9
  23.       Top             =   630
  24.       Width           =   1875
  25.    End
  26.    Begin VB.PictureBox Picture1 
  27.       Appearance      =   0  'Flat
  28.       AutoRedraw      =   -1  'True
  29.       BackColor       =   &H80000005&
  30.       ForeColor       =   &H80000008&
  31.       Height          =   2505
  32.       Left            =   0
  33.       MousePointer    =   2  'Cross
  34.       ScaleHeight     =   2484
  35.       ScaleWidth      =   6648
  36.       TabIndex        =   6
  37.       Top             =   3450
  38.       Width           =   6675
  39.    End
  40.    Begin VB.CommandButton Command1 
  41.       Caption         =   "Output To Printer"
  42.       Height          =   525
  43.       Left            =   4740
  44.       MousePointer    =   1  'Arrow
  45.       TabIndex        =   3
  46.       Top             =   90
  47.       Width           =   1875
  48.    End
  49.    Begin VB.Frame Frame1 
  50.       Caption         =   "BarCode"
  51.       Height          =   915
  52.       Left            =   60
  53.       TabIndex        =   0
  54.       Top             =   60
  55.       Width           =   4635
  56.       Begin VB.TextBox Text1 
  57.          Height          =   285
  58.          Left            =   1620
  59.          MousePointer    =   3  'I-Beam
  60.          TabIndex        =   8
  61.          Text            =   "123456789012"
  62.          Top             =   570
  63.          Width           =   2925
  64.       End
  65.       Begin VB.ComboBox Combo1 
  66.          Height          =   315
  67.          Left            =   1620
  68.          MousePointer    =   1  'Arrow
  69.          Style           =   2  'Dropdown List
  70.          TabIndex        =   1
  71.          Top             =   210
  72.          Width           =   2955
  73.       End
  74.       Begin VB.Label Label4 
  75.          AutoSize        =   -1  'True
  76.          Caption         =   "Press BarCode Code"
  77.          Height          =   195
  78.          Left            =   60
  79.          TabIndex        =   7
  80.          Top             =   600
  81.          Width           =   1470
  82.       End
  83.       Begin VB.Label Label1 
  84.          AutoSize        =   -1  'True
  85.          Caption         =   "Select BarCode Type"
  86.          Height          =   195
  87.          Left            =   60
  88.          TabIndex        =   2
  89.          Top             =   270
  90.          Width           =   1515
  91.       End
  92.    End
  93.    Begin RLBARPRO.RLBar RLBar1 
  94.       Left            =   5760
  95.       Top             =   1392
  96.       _ExtentX        =   699
  97.       _ExtentY        =   699
  98.    End
  99.    Begin VB.Label Label3 
  100.       AutoSize        =   -1  'True
  101.       BackStyle       =   0  'Transparent
  102.       Caption         =   "Click Picture1 Can Show Barcode on Picture1 that mouse position"
  103.       Enabled         =   0   'False
  104.       Height          =   195
  105.       Left            =   60
  106.       TabIndex        =   5
  107.       Top             =   3240
  108.       Width           =   4665
  109.    End
  110.    Begin VB.Label Label2 
  111.       AutoSize        =   -1  'True
  112.       BackStyle       =   0  'Transparent
  113.       Caption         =   "Click Form1 Can Show Barcode on Form1 that mouse position"
  114.       Enabled         =   0   'False
  115.       Height          =   195
  116.       Left            =   90
  117.       TabIndex        =   4
  118.       Top             =   990
  119.       Width           =   4365
  120.    End
  121. Attribute VB_Name = "Form1"
  122. Attribute VB_Creatable = False
  123. Attribute VB_Exposed = False
  124. Public Sub MakeBarDraw(pObject As Object, pX As Single, pY As Single)
  125.   Dim tmpBarText As String
  126.   'Get the BarCode's Code
  127.   tmpBarText = Text1.Text
  128.   'Important!! The [pObject] must can support the
  129.   '                  Drawing Method ,
  130.   '                  eg: [Cls] Method & [Line] Method
  131.   'Clear pObject
  132.   pObject.Cls
  133.   'Draw the BarCode Type that selected of Combo1
  134.   'Draw in pObject
  135.   'CurrentX & Y is mouse location.
  136.   'Code is 1234567890
  137.   'Width is 20,Height is 500
  138.   'Show the Code Text Below
  139.   'Standard Font (No Bold, No Italic or Underline)
  140.   'Font Name is Arial
  141.   'Font Color is Blue (1), BarCode Color is Black (0)
  142.   'Barcode Narrow is 5:2
  143.   'and also show CheckSum.
  144.   Select Case Combo1.ListIndex
  145.     Case 0 'CODABAR (must has 2,4,6,8...etc digits)
  146.       RLBar1.BarCODABAR pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  147.     Case 1 'Code 11
  148.       RLBar1.BarCODE11 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  149.     Case 2 'Code128 (must Start With A,B or C)
  150.       RLBar1.BarCODE128 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  151.     Case 3 'Code25
  152.       RLBar1.BarCODE25 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  153.     Case 4 'Code 39
  154.       RLBar1.BarCODE39 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  155.     Case 5 'Code 39 Extend Full ASCII
  156.       RLBar1.BarCODE39F pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  157.     Case 6 'Code 93
  158.       RLBar1.BarCODE93 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  159.     Case 7 'EAN-13 (must be 12 digits)
  160.       RLBar1.BarEAN13 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  161.     Case 8 'EAN-8 (must be 7 digits)
  162.       RLBar1.BarEAN8 pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  163.     Case 9 'ISBN
  164.       RLBar1.BarISBN pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  165.     Case 10 'Code MSI
  166.       RLBar1.BarMSI pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  167.     Case 11 'PostNet (must be 5,6,9 digits)
  168.       RLBar1.BarPOSTNET pObject, pX, pY, tmpBarText, 20, 100, 0, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  169.     Case 12 'UPC-A (must be 11 digits)
  170.       RLBar1.BarUPCA pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  171.     Case 13 'UPC-A Plus (must be 11 digits)
  172.       RLBar1.BarUPCAPlus pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  173.     Case 14 'UPC-E (must be 6 digits)
  174.       RLBar1.BarUPCE pObject, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  175.   End Select
  176. End Sub
  177. Public Sub MakeBarToPrinter(pX As Single, pY As Single)
  178.   Dim tmpBarText As String
  179.   'Get the BarCode's Code
  180.   tmpBarText = Text1.Text
  181.   '/// in here, we output to printer use set pObject to Printer Object
  182.   'Draw the BarCode Type that selected of Combo1
  183.   'Draw in printer buffer
  184.   'CurrentX & Y is mouse location.
  185.   'Code is 1234567890
  186.   'Width is 10,Height is 500
  187.   'Show the Code Text Below
  188.   'Standard Font (No Bold, No Italic or Underline)
  189.   'Font Name is Arial
  190.   'Font Color is Blue (1), BarCode Color is Black (0)
  191.   'Barcode Narrow is 3:1
  192.   'and also show CheckSum.
  193.   Select Case Combo1.ListIndex
  194.     Case 0 'CODABAR (must has 2,4,6,8...etc digits)
  195.       RLBar1.BarCODABAR Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  196.     Case 1 'Code 11
  197.       RLBar1.BarCODE11 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  198.     Case 2 'Code128 (must Start With A,B or C)
  199.       RLBar1.BarCODE128 Printer, pX, pY, tmpBarText, 20, 400, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  200.     Case 3 'Code25
  201.       RLBar1.BarCODE25 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  202.     Case 4 'Code 39
  203.       RLBar1.BarCODE39 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  204.     Case 5 'Code 39 Extend Full ASCII
  205.       RLBar1.BarCODE39F Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  206.     Case 6 'Code 93
  207.       RLBar1.BarCODE93 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  208.     Case 7 'EAN-13 (must be 12 digits)
  209.       RLBar1.BarEAN13 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  210.     Case 8 'EAN-8 (must be 7 digits)
  211.       RLBar1.BarEAN8 Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  212.     Case 9 'ISBN
  213.       RLBar1.BarISBN Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  214.     Case 10 'Code MSI
  215.       RLBar1.BarMSI Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  216.     Case 11 'PostNet (must be 5,6,9 digits)
  217.       RLBar1.BarPOSTNET Printer, pX, pY, tmpBarText, 20, 500, 0, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  218.     Case 12 'UPC-A (must be 11 digits)
  219.       RLBar1.BarUPCA Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  220.     Case 13 'UPC-A Plus (must be 11 digits)
  221.       RLBar1.BarUPCAPlus Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  222.     Case 14 'UPC-E (must be 6 digits)
  223.       RLBar1.BarUPCE Printer, pX, pY, tmpBarText, 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  224.   End Select
  225.   Printer.EndDoc
  226. End Sub
  227. Private Sub Command1_Click()
  228.   'When user click on Command1
  229.   'This Event will be active
  230.   'then call the function of draw BarCode to printer
  231.   Call MakeBarToPrinter(0, 0)
  232. End Sub
  233. Private Sub Command2_Click()
  234. Dim tmpResult As Integer
  235.   Dim pX As Single
  236.   Dim pY As Single
  237.   pX = 500
  238.   pY = 10
  239.   tmpStep = 1000
  240. 'CODABAR (must has 2,4,6,8...etc digits)
  241.       Printer.CurrentX = 3000
  242.       Printer.Print "CODABAR"
  243.       RLBar1.BarCODABAR Printer, pX, pY, "A123456A", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  244.       pY = pY + tmpStep
  245. 'Code 11
  246.       Printer.CurrentX = 3000
  247.       Printer.Print "Code 11"
  248.       RLBar1.BarCODE11 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  249.       pY = pY + tmpStep
  250. 'Code128 (must Start With A,B or C)
  251.       Printer.CurrentX = 3000
  252.       Printer.Print "Code 128"
  253.       RLBar1.BarCODE128 Printer, pX, pY, "C123456", 20, 400, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  254.       pY = pY + tmpStep
  255. 'Code25
  256.       Printer.CurrentX = 3000
  257.       Printer.Print "Code 25"
  258.       RLBar1.BarCODE25 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  259.       pY = pY + tmpStep
  260. 'Code 39
  261.       Printer.CurrentX = 3000
  262.       Printer.Print "Code 39"
  263.       RLBar1.BarCODE39 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  264.       pY = pY + tmpStep
  265. 'Code 39 Extend Full ASCII
  266.       Printer.CurrentX = 3000
  267.       Printer.Print "Code 39 Full ASCII"
  268.       RLBar1.BarCODE39F Printer, pX, pY, "ABC", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  269.       pY = pY + tmpStep
  270. 'Code 93
  271.       Printer.CurrentX = 3000
  272.       Printer.Print "Code 93"
  273.       RLBar1.BarCODE93 Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  274.       pY = pY + tmpStep
  275. 'EAN-13 (must be 12 digits)
  276.       Printer.CurrentX = 3000
  277.       Printer.Print "EAN-13"
  278.       RLBar1.BarEAN13 Printer, pX, pY, "123456789012", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  279.       pY = pY + tmpStep
  280. 'EAN-8 (must be 7 digits)
  281.       Printer.CurrentX = 3000
  282.       Printer.Print "EAN-8"
  283.       RLBar1.BarEAN8 Printer, pX, pY, "1234567", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  284.       pY = pY + tmpStep
  285. 'ISBN
  286.       Printer.CurrentX = 3000
  287.       Printer.Print "ISBN Code"
  288.       RLBar1.BarISBN Printer, pX, pY, "123456789", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  289.       pY = pY + tmpStep + 500
  290. 'Code MSI
  291.       Printer.CurrentX = 3000
  292.       Printer.Print "MSI Code"
  293.       RLBar1.BarMSI Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  294.       pY = pY + tmpStep
  295. 'PostNet (must be 5,6,9 digits)
  296.       Printer.CurrentX = 3000
  297.       Printer.Print "PostNet"
  298.       RLBar1.BarPOSTNET Printer, pX, pY, "123456789", 20, 100, 0, False, "Arial", QBColor(1), QBColor(0), "3:1", False
  299.       pY = pY + tmpStep - 500
  300. 'UPC-A (must be 11 digits)
  301.       Printer.CurrentX = 3000
  302.       Printer.Print "UPC-A"
  303.       RLBar1.BarUPCA Printer, pX, pY, "12345678901", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  304.       pY = pY + tmpStep
  305. 'UPC-A Plus (must be 11 digits)
  306.       Printer.CurrentX = 3000
  307.       Printer.Print "UPC-A +"
  308.       RLBar1.BarUPCAPlus Printer, pX, pY, "12345678901", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  309.       pY = pY + tmpStep
  310. 'UPC-E (must be 6 digits)
  311.       Printer.CurrentX = 3000
  312.       Printer.Print "UPC-E"
  313.       RLBar1.BarUPCE Printer, pX, pY, "123456", 20, 500, 1, False, "Arial", QBColor(1), QBColor(0), "3:1", True
  314.       pY = pY + tmpStep
  315.   Printer.EndDoc
  316. End Sub
  317. Private Sub Form_Load()
  318.     Combo1.AddItem "Codabar"
  319.     Combo1.AddItem "Code_11"
  320.     Combo1.AddItem "Code_128"
  321.     Combo1.AddItem "Code_25"
  322.     Combo1.AddItem "Code_39"
  323.     Combo1.AddItem "Code_39F"
  324.     Combo1.AddItem "Code_93"
  325.     Combo1.AddItem "EAN_13"
  326.     Combo1.AddItem "EAN_8"
  327.     Combo1.AddItem "ISBN"
  328.     Combo1.AddItem "Code_MSI"
  329.     Combo1.AddItem "PostNet"
  330.     Combo1.AddItem "UPC_A"
  331.     Combo1.AddItem "UPC_A_Plus"
  332.     Combo1.AddItem "UPC_E"
  333.     Combo1.ListIndex = 4
  334. End Sub
  335. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  336.   'When user click on Form1
  337.   'This Event will be active
  338.   'then call the function of draw BarCode on Form1
  339.   Call MakeBarDraw(Form1, X, Y)
  340. End Sub
  341. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  342.   'When user click on Picture1
  343.   'This Event will be active
  344.   'then call the function of draw BarCode on Picture1
  345.   Call MakeBarDraw(Picture1, X, Y)
  346. End Sub
  347.